<?php
 //
function dropdown_day() {
    $cur_day = date("d");
    echo "<select name='day'>";
    for ($day = 1; $day <= 31; $day++) {
        if ($day == $cur_day) {
            echo "<option selected='selected'>" . $day . "</option>" . "\n";
        } else {
            echo "<option>" . $day . "</option>" . "\n";
        }
    }
    echo "</select>";
}
//
function dropdown_month() {
    $cur_month = date("m");
    echo "<select name='month'>";
    for ($month = 1; $month <= 12; $month++) {
        if ($month == $cur_month) {
            echo "<option selected='selected'>" . $month . "</option>" . "\n";
        } else {
            echo "<option>" . $month . "</option>" . "\n";
        }
    }
    echo "</select>";
}

//
function dropdown_year($start_year = FALSE, $end_year = FALSE) {
    $start_year = ($start_year) ? $start_year - 1 : date('Y') - 10;
    $end_year = ($end_year) ? $end_year : date('Y');

    echo "<select name='year'>";
    for ($i = $end_year; $i > $start_year; $i -= 1) {
        echo "<option>{$i}</option>";
    }
    echo "</select>";
}

//Get the last day of the month
function get_month_lastday($month_num = FALSE, $year = FALSE) {
// $month_num = month in two-digit form
//   leave blank for current month
// $year = year in four-digit form
//   leave blank for current year
// Set the proper month (current if non passed)
    $month_num = ($month_num) ? $month_num : date('m');
    $year = ($year) ? $year : date('Y');

// return the last day of the requested month
    return date('Y-m-d', strtotime('-1 second', strtotime('+1 month', strtotime($month_num . '/01/' . $year . ' 00:00:00'))));
}


?>